Region based program specialization: an operational approach to polymorphic offline partial evaluation for ML-like languages

نویسنده

  • Simon Helsen
چکیده

Program specialization or partial evaluation is a proven program optimization technique dating back to the early seventies. It is based on aggressive constant propagation and function unfolding, and is usually employed as an extra tool in the program compilation process. Partial evaluation works remarkably well when the program input can be factored in static, less variable, and dynamic, often changing, parts. A partial evaluator transforms the source program by reducing as much operations as possible with respect to the static input. The resulting program is usually faster than the original program whenever the latter has to be executed with its static input. One common flavor of program specialization is offline partial evaluation. It employs a program analysis to determine what operations can be reduced at specialization time. Historically, offline systems used simple binding-time annotation techniques, or considered simply-typed programming languages. These approaches have hampered offline methods in reaching their full potential. In this thesis, we aim to address these limitations. We describe the development of a new and entirely operational theory for offline polymorphic specialization of ML-like languages by combining techniques from dynamic memory management with program specialization. Our approach is based on the region calculus of Tofte and Talpin, a polymorphically typed lambda calculus with annotations that make memory allocation and deallocation explicit. It is intended as an intermediate language for implementing Hindley-Milner typed functional languages without traditional trace-based garbage collection. Static region and effect inference can be used to annotate a statically-typed ML program with memory management primitives. The formal correctness proof of our novel specialization technique based on a region type system requires two theoretical building blocks: a type soundness proof for the region calculus and a correctly proven equational theory between region-annotated terms. To establish the first building block, we present a new formulation of type soundness for the region and effect system of the region calculus. Such a property is crucial to guarantee safe deallocation of regions, i.e., deallocation should only take place for objects which are provably dead. The original soundness proof by Tofte and Talpin is based on a big-step evaluation-style operational semantics and requires a complex co-inductive safety relation. We reformulate type soundness with respect to two small-step operational semantics. Following the standard syntactic approach of Wright, Felleisen and Harper, we obtain simple inductive proofs. The first semantics is storeless. It is simple and gives rise to perspicuous proofs. The second imperative …

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Program Generation with Class

We have implemented a program generation library for polymorphically typed functional languages with lazy evaluation. The library combinators perform program generation by partial evaluation, a technique which allows the generation of highly-customized and efficient specialized output programs from general, parameterized input programs. Previously implemented program generation libraries for po...

متن کامل

Specialization of Functional Logic Programs Based on Needed Narrowing Specialization of Functional Logic Programs Based on Needed Narrowing

Functional logic languages with a complete operational semantics are based on narrowing, a uniication-based goal-solving mechanism which subsumes the reduction principle of functional languages and the resolution principle of logic languages. Needed narrowing is an optimal narrowing strategy and the basis of several recent functional logic languages. In this paper, we deene a partial evaluator ...

متن کامل

Specialization of Functional Logic Programs Based on Needed Narrowing ? Preliminary Version

Functional logic languages with a complete operational semantics are based on narrowing, a uniication-based goal-solving mechanism which subsumes the reduction principle of functional languages and the resolution principle of logic languages. Needed narrowing is an optimal narrowing strategy and the basis of several recent functional logic languages. In this paper, we deene a partial evaluator ...

متن کامل

Two Flavors of Offline Partial Evaluation

Type-directed partial evaluation is a new approach to program specialization for functional programming languages. Its merits with respect to the traditional offline partial evaluation approach have not yet been fully explored. We present a comparison of type-directed partial evaluation with standard offline partial evaluation in both a qualitative and quantitative way. For the latter we use im...

متن کامل

ML Partial Evaluation using Set-Based Analysis

We describe the design and implementation of an off-line partial evaluator for Standard ML programs. Our partial evaluator consists of two phases: analysis and specialization. Analysis: Set-based analysis is used to compute control flow, data flow and binding-time information. It provides a combination of speed and accuracy that is well suited to partial-evaluation applications: the analysis pr...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2002